package com.bw.zg2.view.adapter

import android.content.Context
import android.widget.ImageView
import com.bumptech.glide.Glide
import com.bw.zg2.R
import com.bw.zg2.bean.GoodsTypeBean
import com.bw.zg2.bean.GoodsTypeItem
import com.zhy.adapter.recyclerview.CommonAdapter
import com.zhy.adapter.recyclerview.base.ViewHolder

/**
 *
 * @ClassName: TypeGoodsAdapter
 * @Description: java类作用描述
 * @Author: zhangyanchao
 * @CreateDate: 2024/9/21 9:32 AM
 * @Version: 1.0
 */
class TypeGoodsAdapter(context: Context?, layoutId: Int, datas: List<GoodsTypeItem>) :
    CommonAdapter<GoodsTypeItem>(context, layoutId, datas) {
    override fun convert(holder: ViewHolder?, t: GoodsTypeItem?, position: Int) {
        holder?.setText(R.id.tv_type, t?.category_name)
        val imageView = holder?.getView<ImageView>(R.id.iv_goods)

        if (imageView != null) {
            Glide.with(mContext).load(t?.category_icon)
                .placeholder(R.drawable.ic_launcher_background)
                .into(imageView)
        }
//        imageView?.let { Glide.with(mContext).load(t?.category_icon).into(it) }

    }
}